package renguanyu.app.tools.model.anjuke;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ScalarHandler;

import renguanyu.app.tools.util.DbUtil;

public class BhmsDao {

	QueryRunner queryRunner = DbUtil.getQueryRunner();

	public Integer queryPvn(String communityName) throws SQLException {
		if (communityName.contains("新城御景")) {
			communityName = "新城御景";
		}
		if (communityName.contains("学府花园")) {
			communityName = "学府花园";
		}
		StringBuilder sql = new StringBuilder();
		sql.append("select total  ");
		sql.append("from bhms_community ");
		sql.append("where created_at  = (select max(created_at) from bhms_community) ");
		sql.append("and community  = '" + communityName + "' ");
		return queryRunner.query(sql.toString(), new ScalarHandler<Integer>());
	}

}
